package com.lihepeng.leecode.tree;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public class Solution589 {
    List<Integer> res = new ArrayList<>();
    /**
     * 前序遍历
     * @param root
     * @return
     */
    public List<Integer> preorder(NTreeNode root) {
        if (root ==null) {
            return res;
        }
        res.add(root.val);
        for (NTreeNode nTreeNode:root.children) {
            preorder(nTreeNode);
        }
        return res;

    }


}
